﻿using Quba.Business.Services.Abstract.User;
using Quba.DataAccess.Repositories.Abstract;
using Quba.DataAccess.Repositories.Concrete;
using Quba.Entities.Database.General;
using Quba.Entities.Database.User;

namespace Quba.Business.Services.Concrete.User
{
    public class UserBusiness : ICandidateBusiness, IAdminBusiness
    {
        #region Collaborators
        private readonly ICandidateRepository _candidateRepository;
        private readonly IAdminRepository _adminRepository;
        #endregion Collaborators

        #region ctor
        public UserBusiness()
        {
            _candidateRepository =  new CandidateRepository();
            _adminRepository = new AdminRepository();
        }
        #endregion ctor

        #region Candidate
        public BaseEntity RegisterCandidate(Candidate candidate)
        {
            return
                _candidateRepository.Add(candidate);
        }

        public Candidate GetCandidateDetailsById(int candidateId)
        {
            return
                _candidateRepository.Get(candidateId);
        }
        #endregion Candidate

        #region Admin

        public BaseEntity RegisterNewAdmin(Admin admin)
        {
            return
                _adminRepository.Add(admin);
        }

        public Admin GetAdminDetailsById(int adminId)
        {
            return
                _adminRepository.Get(adminId);
        } 
        #endregion Admin

    }
}